import { createApp } from 'vue'
import App from './App.vue'
import router from './router' /*引入全局路由*/
import store from './store'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/reset.css';
import * as Icons from '@ant-design/icons-vue'; //全局引入图标
import axios from "axios";
/*加载内部的js文件 - 放在src的assets/js目录*/
import './assets/js/enums';

const app = createApp(App)

app.use(store).use(router).use(Antd).mount('#app')

//全局使用图标
const icons = Icons;
for (const i in icons){
    app.component(i, icons[i]);
}

/**
 * axios拦截器  - 自定义日志
 */
axios.interceptors.request.use(function (config) {
    console.log('请求参数：', config);
    return config;
}, error => {
    return Promise.reject(error);
});
axios.interceptors.response.use(function (response) {
    console.log('返回结果：', response);
    return response;
}, error => {
    console.log('返回错误：', error);
    return Promise.reject(error);
});

axios.defaults.baseURL = process.env.VUE_APP_SERVER; //给axios添加基础路径
console.log('环境：', process.env.NODE_ENV);
console.log('服务端：', process.env.VUE_APP_SERVER);